package com.jiepu.homework;

import java.util.Scanner;

public class Exercise1 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		System.out.println("请输入一串数字：");
		String numbers = sc.nextLine();
		int[] arr = new int[10];
		for (int i = 0; i < numbers.length(); i++) {
			arr[numbers.charAt(i) - 48]++;
		}
		int maxPos = 0;
		for (int i = 0; i < arr.length; i++) {
			if (arr[i] > arr[maxPos]) {
				maxPos = i;
			}
		}

		String msg = "频率最高数字为：";
		for (int i = 0; i < arr.length; i++) {
			if (arr[i] == arr[maxPos]) {
				msg += i + ",";
			}
		}
		System.out.println(msg.substring(0, msg.length() - 1));

	}
}
